home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / h / ingres.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-18  |  5.1 KB  |  234 lines

  1.  
  2. /*
  3. **  INGRES.H -- basic header file for ingres.
  4. **
  5. **    See also aux.h for definitions used by some but not all.
  6. **
  7. **    Version:
  8. **        @(#)ingres.h    8.4    12/8/85
  9. */
  10.  
  11. # ifndef MAXNAME
  12.  
  13.  
  14. /*
  15. **  Some generally useful stuff.
  16. */
  17.  
  18. # include <useful.h>
  19.  
  20. /*
  21. **    Definition of machine type
  22. **
  23. **    Currently the default is to the 32 bits existant on VAX 11/780s.
  24. */
  25.  
  26. # include <trace.h>
  27.  
  28. /*
  29. **    INGRES manifest constants
  30. **
  31. **    These constants are manifest to the operation of the entire
  32. **    system.  If anything
  33. **    is changed part or all of the system will stop working.
  34. **    The values have been carefully chosen and are not intended
  35. **    to be modifiable by users.
  36. */
  37.  
  38. # define    MAXDOM        50        /* max # + 1 of doms in a relation */
  39. # define    MAXNAME        12        /* max size of a name (in bytes) */
  40. # define    MAXVAR        10        /* max # of variables */
  41. # define    MAXKEYS        6        /* max # of keys in secondary index */
  42. # define    MAXAGG        50        /* max number of aggs in a qry */
  43. # define    STACKSIZ    20        /* max depth for arith. expr. stacks */
  44.  
  45. # define    i_1        char
  46. # define    i_2        short
  47. # define    i_4        long
  48. # define    c_1        char
  49. # define    c_2        char
  50. # define    c_12        char
  51. # define    c_16        char
  52.  
  53. /*
  54. **    RELATION relation struct
  55. **
  56. **    The RELATION relation contains one tuple for each relation
  57. **    in the database.  This relation contains information which
  58. **    describes how each relation is actually stored in the
  59. **    database, who the owner is, information about its size,
  60. **    assorted operation information, etc.
  61. */
  62.  
  63. # define    RELID        1    /* domain for setkey */
  64. # define    RELOWNER    2
  65.  
  66. struct relation
  67. {
  68.     c_12    relid[MAXNAME];    /* relation name    */
  69.     c_2    relowner[2];    /* code of relation owner */
  70.     i_1    relspec;    /* storage mode of relation    */
  71.                 /* M_HEAP  unsorted paged heap    */
  72.                 /* -M_HEAP compressed heap    */
  73.                 /* M_ISAM  isam            */
  74.                 /* -M_ISAM compressed isam    */
  75.                 /* M_HASH  hashed        */
  76.                 /* -M_HASH compressed hash    */
  77.     i_1    relindxd;    /* -1 rel is an index, 0 not indexed, 1 indexed */
  78.     i_2    relstat2;    /* more status bits */
  79.     i_2    relstat;    /* relation status bits */
  80.     i_4    relsave;    /*unix time until which relation is saved*/
  81.     i_4    reltups;    /*number of tuples in relation    */
  82.     i_2    relatts;    /*number of attributes in relation    */
  83.     i_2    relwid;        /*width (in bytes) of relation    */
  84.     i_4    relprim;    /*no. of primary pages in relation*/
  85.     i_4    relfree;    /* head of freelist (b-trees only) */
  86.     i_4    relstamp;    /* time of last mod*/
  87.     i_2    reldim;        /* ordering dimension */
  88. };
  89.  
  90.  
  91. /*
  92. **    ATTRIBUTE relation struct
  93. **
  94. **    The ATTRIBUTE relation contains one tuple for each domain
  95. **    of each relation in the database.  This relation describes
  96. **    the position of each domain in the tuple, its format,
  97. **    its length, and whether or not it is used in part of the key.
  98. */
  99.  
  100. # define    ATTRELID    1
  101. # define    ATTOWNER    2
  102. # define    ATTID        3
  103. # define    ATTNAME        4
  104.  
  105.  
  106. struct attribute
  107. {
  108.     c_12     attrelid[MAXNAME];    /*relation name of which this is an attr */
  109.     c_2    attowner[2];    /* code of relation owner */
  110.     i_2    attid;        /*domain number (from 1 to relatts)    */
  111.     c_12    attname[MAXNAME];    /*alias for this domain*/
  112.     i_2    attoff;        /*offset in tuple (no. of bytes*/
  113.     i_1    attfrmt;    /* INT, FLOAT, CHAR (in symbol.h) */
  114.     i_1    attfrml;    /* unsigned integer no of bytes    */
  115.     i_1    attxtra;    /* flag indicating whether this dom is part of a key */
  116. };
  117.  
  118. /*
  119. **    tuple id struct
  120. **
  121. **    We want the line_id to be in the low-order of a long, in
  122. **    order to make index work efficiently; since the order
  123. **    of halfwords is reversed in a VAX, this is dependent...
  124. */
  125.  
  126. struct tup_id
  127. {
  128. # ifdef VAX
  129.     c_1    line_id, pg2, pg1, pg0;
  130. # else
  131.     c_1    pg0, pg1, pg2, line_id;
  132. # endif
  133. };
  134.  
  135. typedef struct tup_id    TID;
  136.  
  137. typedef union
  138. {
  139.     long    ltid;
  140.     TID    s_tupid;
  141. } tid_type;
  142.  
  143.  
  144. # include <range.h>        /* to get the descriptor struct */
  145.  
  146.  
  147. /* modes to find */
  148. # define    NOKEY        1    /* scan entire relation */
  149. # define    EXACTKEY    2
  150. # define    LRANGEKEY    3    /* low range key */
  151. # define    FULLKEY        4    /* forces full key comparison */
  152. # define    HRANGEKEY    5    /* high range key */
  153. # define    BTREEKEY    6    /* search btree with  exact lid keys */
  154. # define    BTREERANGE    7    /* use btree range to aid search */
  155.  
  156. /*
  157. **    anytype union -- union of ingres types
  158. */
  159.  
  160. union anytype
  161. {
  162.     char        i1type;
  163.     short        i2type;
  164.     long        i4type;
  165.     float        f4type;
  166.     double        f8type;
  167.     char        c0type[1];    /* the 1 is bogus, only needs 
  168.                      * starting address
  169.                      */
  170.     char        *cptype;
  171.     char        **cpptype;
  172. };
  173.  
  174. typedef union anytype    ANYTYPE;
  175.  
  176.  
  177. /*
  178. **  Definitions for interface to the control module.
  179. */
  180.  
  181. extern char    Qbuf[];
  182.  
  183. /* structures for user defined delimiters */
  184.  
  185. # define    BITS        8
  186. # define    ACHARS        128
  187. # define    BITMAPLEN    ACHARS/ BITS
  188.  
  189.  
  190. struct dmap
  191. {
  192.     int        order;    /* order in bitmap list */
  193.     char        bits[ACHARS];/* 16 8-bit chars, each bits is one ascii char */
  194.     int         type;    /* 0 = ONE, 1 = ZEROMORE */
  195.     struct dmap     *next;    /* pointer to next map */
  196. };
  197. typedef struct dmap DMAP;
  198.  
  199. struct delimlist 
  200. {
  201.     char            group[12];
  202.     char            delim[12];
  203.     struct dmap         *maptr;        /* pointer to map queue */
  204.     struct delimlist    *back;        /* pointer to delim after */
  205. };
  206. typedef struct delimlist DELIMLIST;
  207.  
  208. struct delim_tup
  209. {
  210.     int    order;
  211.     char    group[12];
  212.     char    delim[12];
  213.     int    type;
  214.     char     bitmap[16];
  215. };
  216.  
  217. typedef struct delim_tup DELIM_TUP;
  218.  
  219.  
  220.  
  221. /*     structure for saving the header fields */
  222.  
  223. struct hdrinfo
  224. {
  225.     int        len;
  226.     struct hdrinfo     *next;
  227. } ;
  228.  
  229. typedef struct hdrinfo HDRINFO;
  230.  
  231.  
  232. # endif MAXNAME
  233.  
  234.